﻿namespace Digitalmes.Scada.Events;

/// <summary>
/// 事件抽象类
/// </summary>
public abstract class AbstractAfterEvent
{
    /// <summary>
    /// 线体编号
    /// </summary>
    [NotNull]
    public string? LineCode { get; set; }

    /// <summary>
    /// 工位编号
    /// </summary>
    [NotNull]
    public string? OpCode { get; set; }

    /// <summary>
    /// 数据处理状态
    /// </summary>
    public int State { get; set; }

    /// <summary>
    /// 错误消息，不存在则为 null。
    /// </summary>
    public string? ErrorMessage { get; set; }

    /// <summary>
    /// 内部错误代码。
    /// </summary>
    public int InnerErrorCode { get; set; }

    /// <summary>
    /// 数据模式，参考 <see cref="AfterEventMode"/>。
    /// </summary>
    [NotNull]
    public string? Mode { get; set; }

    /// <summary>
    /// 要后续处理的数据。
    /// </summary>
    public object? Target { get; set; }
}

/// <summary>
/// 事件模式选项
/// </summary>
public static class AfterEventMode
{
    /// <summary>
    /// 进站
    /// </summary>
    public const string Inbound = "inbound";

    /// <summary>
    /// 出站
    /// </summary>
    public const string Outbound = "outbound";

    /// <summary>
    /// 扫关键物料
    /// </summary>
    public const string ScanBarcode = "scanbarcode";

    /// <summary>
    /// 扫批次料
    /// </summary>
    public const string ScanBatch = "scanbatch";

    /// <summary>
    /// 上料
    /// </summary>
    public const string Feeding = "feeding";
}
